<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
	
<%@page import="ahxu.search.db.PageResults"%>
<%@page import="ahxu.search.db.FinalResult"%>
<%
	List<CrawlerSite> result=(List<CrawlerSite>)request.getAttribute("results");
	if(result==null) {
		response.sendRedirect("crawler_sites_do.jsp");
		return;
	}
	CrawlerManager m=(CrawlerManager)request.getSession().getAttribute("CrawlerManager");
	Boolean isStart=false;
	if(m!=null) {
		isStart=!m.isShutDown();
	}	
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


<%@page import="java.util.List"%>
<%@page import="ahxu.crawler.CrawlerSite"%>
<%@page import="ahxu.crawler.CrawlerManager"%><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<%if(Boolean.TRUE.equals(isStart)){ %><meta http-equiv="refresh" content="5" /><%} %>
<title>Insert title here</title>
<script type="text/javascript" src="scripts/jquery-1.3.2.min.js"></script>
<script language="JavaScript">
  <!--
 	function submitForm(formId,action){
	 	$("#"+formId).attr("action",action);
	 	$("#"+formId).submit();
  }
  //-->
  </script>
</head>
<body>
<form id="configForm" action="search_do.jsp" method="post">
<table width="90%" border="1">
  <tr>
      <tr>
    <td width="4%">序号</td>
    <td width="34%">网址</td>
    <td width="27%">名称</td>
    <td width="11%">只抓同一站点</td>
    <td width="8%">抓取层数</td>
    <td width="8%">抓取数量</td>
    <td width="8%">操作[<a href="crawler_sites_new.jsp">添加</a>]</td>
  </tr>
  <%int i=1;for(CrawlerSite obj:result){ %>
  <tr>
    <td><input type="checkbox" name="crawlerSiteSelected" id="checkbox" checked="checked" value="<%=obj.getId()%>"/><%=i++ %></td>
    <td><%=obj.getInput().getUri() %></td>
    <td><%=obj.getInput().getAnchorText() %></td>
    <td><%=obj.isLimitSameSite() %></td>
    <td><%=obj.getDeep() %></td>
    <td><%=obj.getTotal()%></td>
    <td><a href="crawler_sites_do.jsp?action=delete&id=<%=obj.getId()%>">删除</a></td>
  </tr>
  <%} %>
</table>
</form>
<p> <%
     
     if(isStart==null || Boolean.FALSE.equals(isStart)){ %>
      <input type="submit" name="button2" id="button2" value="开始抓取" onclick="submitForm('configForm','crawl_start_do.jsp')"/>
      <%}
     if(Boolean.TRUE.equals(isStart)){ 
     %>
    <input type="submit" name="button3" id="button3" value="停止抓取" onclick="submitForm('configForm','crawl_end_do.jsp')"/></td>
    <%} %>
    <a href="search.jsp">[查看结构化结果]</a> &nbsp; &nbsp;
    <a href="unfinal_search.jsp">[查看非结构化结果]</a> &nbsp; &nbsp;
    <a href="train.jsp">[训练]</a> &nbsp; &nbsp;
    <a href="extract.jsp">[抽取]</a> &nbsp; &nbsp;
    </p>
</body>
</html>
